home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Info / TeachU14 / SAMS / Code / Day12 / dbfindu.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-08  |  2.1 KB  |  62 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "DbFindU.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init);
  8. #pragma resource "*.dfm"
  9. TForm3 *Form3;
  10. //---------------------------------------------------------------------------
  11. __fastcall TForm3::TForm3(TComponent* Owner)
  12.   : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16.  
  17. void __fastcall TForm3::DBNamesComboBoxChange(TObject *Sender)
  18. {
  19.   if (Table1->Active == true)
  20.     Table1->Active = false;
  21.   TablesComboBox->Text = "";
  22.   String DBName = DBNamesComboBox->Text;
  23.   TDatabase* db = new TDatabase(this);
  24.   db->AliasName = DBName;
  25.   if (db->IsSQLBased)
  26.     Session->GetTableNames(DBName, "",
  27.       false, true, TablesComboBox->Items);
  28.   else
  29.     Session->GetTableNames(DBName, "",
  30.       true, false, TablesComboBox->Items);
  31.   Table1->DatabaseName = DBName;
  32.   TablesComboBox->DroppedDown = true;
  33.   delete db;
  34. }
  35. //---------------------------------------------------------------------------
  36.  
  37. void __fastcall TForm3::TablesComboBoxChange(TObject *Sender)
  38. {
  39.   if (Table1->Active == true)
  40.     Table1->Active = false;
  41.   Table1->TableName = TablesComboBox->Text;
  42.   Table1->Active = true;
  43.   FieldsComboBox->Items->Clear();
  44.   FieldsComboBox->Enabled = true;
  45.   ValueEdit->Enabled = true;
  46.   Table1->GetFieldNames(FieldsComboBox->Items);
  47.   FieldsComboBox->Text = FieldsComboBox->Items->Strings[0];
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TForm3::FormCreate(TObject *Sender)
  51. {
  52.   Session->GetDatabaseNames(DBNamesComboBox->Items);
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TForm3::FilterBtnClick(TObject *Sender)
  56. {
  57.   TLocateOptions SearchOptions;
  58.   SearchOptions << loPartialKey;
  59.   Table1->Locate(FieldsComboBox->Text, ValueEdit->Text, SearchOptions);
  60. }
  61. //---------------------------------------------------------------------------
  62.